

//创建列表部件
    //1.创建列表
    lv_obj_t* list = lv_list_create(lv_scr_act());
    lv_obj_set_size(list, 200, 400);
    lv_obj_set_align(list, LV_ALIGN_CENTER);
    //2.添加列表文本
    lv_list_add_text(list, "Settings");

    //添加列表按钮
    lv_obj_t* btn1 = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WIFI");
    lv_obj_t* btn2 = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WIFI");
    lv_obj_t* btn3 = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WIFI");
    lv_obj_t* btn4 = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WIFI");
    lv_obj_t* btn5 = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WIFI");

    //获取列表按钮

    lv_obj_add_event_cb(btn1, event_cb, LV_EVENT_CLICKED, NULL);
    //将列表文本输出
    static void event_cb(lv_event_t* e)
    {
        lv_obj_t* target = lv_event_get_target(e);
        printf("%s", lv_list_get_btn_text(list, target));
    }
    //将列表文本显示在屏幕上、将点击的列表背景栏变蓝
static void event_cb(lv_event_t* e)
{
    lv_obj_t* target = lv_event_get_target(e);
    lv_label_set_text(label, lv_list_get_btn_text(list, target));
    //选中后此栏变蓝
    lv_obj_add_state(target, LV_STATE_FOCUS_KEY);
}

/********例子************ */

lv_obj_t* list = lv_list_create(lv_scr_act());  /* 创建列表 */
lv_obj_set_width(list, 200);                    /* 设置列表宽度 */
lv_obj_set_height(list, 200);                   /* 设置列表高度 */
lv_obj_center(list);

lv_obj_t* btn;
lv_list_add_text(list, "File");                            /* 列表添加标签 */
btn = lv_list_add_btn(list, LV_SYMBOL_FILE, "New");        /* 添加按钮 */
btn = lv_list_add_btn(list, LV_SYMBOL_DIRECTORY, "Open");  /* 添加按钮 */
lv_list_add_text(list, "Direction");                       /* 列表添加标签 */
btn = lv_list_add_btn(list, LV_SYMBOL_UP, "Up");           /* 添加按钮 */
btn = lv_list_add_btn(list, LV_SYMBOL_DOWN, "Down");       /* 添加按钮 */